var a = getApp();

Page({
    data: {
        num: 0,
        page: 0,
        page1: 0,
        prenumber: 6,
        cdType: "",
        wzshow: !0
    },
    particulars: function(a) {
        console.log("详情页"), console.log(a.currentTarget.dataset.id), wx.setStorageSync("eduid", a.currentTarget.dataset.id), 
        wx.navigateTo({
          url: "/hyb_yl/backstageLife/pages/particulars/particulars"
        });
    },
    onclick1: function(t) {
        var e = this;
        // wx.request({
        //     url: a.globalData.dic + "doctor/education/collect/0/" + e.data.prenumber + "/" + e.data.token,
        //     success: function(a) {
        //         console.log(a.data.data), a.data.data.length <= 0 ? e.setData({
        //             wzshow: !0,
        //             arr: []
        //         }) : e.setData({
        //             wzshow: !1,
        //             arr: a.data.data,
        //             page1: 1
        //         });
        //     }
        // });
        var shuju = {
          collectRow:1,
          title:'小花',
          collectAuthor:'小明',
          releaseDayTime:'2018-10-23',
          collectModule:'小强',
          coverImg: "/assets/images/vd.png",
          collectType:2
        };
      var shuju1 = [shuju, shuju, shuju, shuju];
      e.setData({
        arr:shuju1
      })
    },
    lower1: function() {
        if (!this.data.noFlag && !this.data.closureFlag) {
            this.setData({
                closureFlag: !0
            });
            var t, e = this, o = e.data.page1, n = e.data.arr;
            wx.request({
                url: a.globalData.dic + "doctor/education/collect/" + o + "/" + e.data.prenumber + "/" + e.data.token,
                success: function(a) {
                    if (console.log(a), 200 == a.data.code) {
                        o++, e.setData({
                            page1: o
                        });
                        var c = a.data.data;
                        if (t = n.concat(c), a.data.data.length == []) return e.setData({
                            noFlag: !0,
                            closureFlag: !1
                        }), !1;
                        e.setData({
                            arr: t,
                            closureFlag: !1
                        }), wx.showLoading({
                            title: "加载中",
                            icon: "loading"
                        }), setTimeout(function() {
                            wx.hideLoading();
                        }, 1500);
                    }
                }
            });
        }
    },
    click: function(t) {
        var e = this;
        console.log(t.currentTarget.dataset.id);
        var o = t.currentTarget.dataset.id;
        wx.showModal({
            title: "提示",
            content: "您确认取消收藏吗",
            success: function(t) {
                t.confirm ? (console.log("用户点击确定"), wx.request({
                    url: a.globalData.dic + "doctor/education/deleteCollect/" + o + "/" + e.data.token,
                    success: function(a) {
                        console.log(a), e.onclick1();
                    }
                })) : t.cancel && console.log("用户点击取消");
            }
        });
    },
    onLoad: function(a) {
        this.setData({
            token: wx.getStorageSync("log") || ""
        });
    },
    onShow: function() {
        var a = this;
        this.setData({
            noFlag: !1
        }), a.onclick1(), wx.getSystemInfo({
            success: function(t) {
                a.setData({
                    height: t.windowHeight
                });
            }
        });
    },
    share: function(a) {
        console.log("分享"), console.log(a), wx.setStorageSync("currentSaid", this.data.arr[a.currentTarget.dataset.index]), 
        wx.navigateTo({
          url: "/hyb_yl/backstageLife/publishSaid/publishSaid?fromType=2&patientType=3"
        });
    }
});